﻿/*******************************************************
* Copyright (c) 2018-2088, By XuXiang all rights reserved.
*
* FileName: FightFrameRecord.h
* Summary: 战斗帧记录。
*
* Author: XuXiang
* Date: 2024-06-06 22:46
*******************************************************/

#ifndef __FightFrameRecord_h__
#define __FightFrameRecord_h__

#include <vector>
#include <string>
#include <Macro.h>
using namespace std;

namespace Competition
{
	namespace Net
	{
		class SCFightOperateFrameNotify;
		class SCFightFrameRecordResponse;
	}

	//战斗帧索引
	class FightFrameIndex
	{
	public:
		FightFrameIndex();
		FightFrameIndex(int c, int i);

		//数据块索引
		int chunk = 0;

		//块内数据索引
		int index = 0;
	};

	//战斗操作记录
	class FightFrameRecord
	{
	public:

		//数据块大小
		static int ChunkSize;

		//构造析构函数
		FightFrameRecord();
		~FightFrameRecord();

		//添加帧数据
		void AddFrame(Net::SCFightOperateFrameNotify& ntf);

		//获取帧记录
		int TakeRecord(int start, int end, bool last, Net::SCFightFrameRecordResponse& res);

	private:

		//当前块写入索引
		int m_WriteIndex = 0;

		//数据区块
		vector<Byte*> m_Chunks;

		//帧率列表
		vector<FightFrameIndex> m_Frames;
	};
}

#endif